<template>
  <div class="equipment-manage">
    <section class="section-wrap">
      <div class="equipment-total">
        <icon-svg icon-name="dianzihuidan"
                  class="spacing" />设备总数：<span class="col">{{ deviceInfo.count }}</span>
      </div>
      <div class="modular">
        <div class="classify company-n"
             @click="cliDetailed(0)">
          <div class="classify-top equipment-bg">设备不在公司</div>
          <div class="classify-info">
            <p class="general">
              <span class="size">{{ deviceInfo.notInHome }}</span>台
            </p>
            <p class="recovery-call">
              待回收：<span @click.stop="cliStatus(0, 0)">{{
                deviceInfo.recycled
              }}</span>台
            </p>
            <p class="recovery-call">
              待催缴：<span @click.stop="cliStatus(0, 1)">{{
                deviceInfo.call
              }}</span>台
            </p>
          </div>
        </div>
        <div class="classify company-y"
             @click="cliDetailed(1)">
          <div class="classify-top equipment-bg">设备在公司</div>
          <div class="classify-info">
            <p class="general">
              <span class="size">{{ deviceInfo.inHome }}</span>台
            </p>
            <p class="recovery-call">
              正常使用：<span @click.stop="cliStatus(1, 0)">{{
                deviceInfo.normal
              }}</span>台
            </p>
            <p class="recovery-call">
              闲置设备：<span @click.stop="cliStatus(1, 1)">{{
                deviceInfo.unUsed
              }}</span>台
            </p>
          </div>
        </div>
        <div class="classify off"
             @click="cliStatus(2, 1)">
          <div class="classify-top equipment-bg-off">设备已注销</div>
          <div class="classify-info">
            <p class="general">
              <span class="size">{{ deviceInfo.logout }}</span>台
            </p>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
import { equipment } from "@/api/index";
export default {
  name: "EquipmentManage",
  data () {
    return {
      deviceInfo: {}
    };
  },
  created () {
    this.getTotal();
  },
  methods: {
    async getTotal () {
      let response = await equipment.quantityStatistics();
      this.deviceInfo = response.data;
    },
    cliDetailed (inHome) {
      this.$router.push({
        path: "/equipmentDetails",
        query: { inHome: inHome }
      });
    },
    cliStatus (inHome, status) {
      this.$router.push({
        path: "/equipmentDetails",
        query: { inHome: inHome, status: status }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.equipment-manage {
  transform: translate(0, 0);
}
.section-wrap {
  background: var(--prev-bg-white);
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - 125px);
}
.equipment-total {
  font-size: 18px;
  margin-bottom: 10px;
  .spacing {
    margin-right: 10px;
  }
  .col {
    color: #65a1f6;
  }
}
.modular {
  display: flex;
  justify-content: space-between;
}
.classify {
  width: 506px;
  height: 206px;
  border-radius: 5px;
  background-color: rgba(250, 250, 250, 0.39);
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  margin-top: 25px;
  cursor: pointer;
}
.company-n {
  background: #fafafa url("../../../static/images/equipment1.png") 280px 20px
    no-repeat;
}
.company-y {
  background: #fafafa url("../../../static/images/equipment2.png") 280px 20px
    no-repeat;
}
.off {
  background: #fafafa url("../../../static/images/equipment3.png") 280px 20px
    no-repeat;
}
.classify-top {
  width: 163px;
  height: 51px;
  color: #fcfafa;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.equipment-bg {
  background: transparent url("../../../static/images/equipment-left1.png")
    no-repeat;
}
.equipment-bg-off {
  background: transparent url("../../../static/images/equipment-left2.png")
    no-repeat;
}
.classify-info {
  padding-left: 50px;
}
.size {
  width: 72px;
  height: 56px;
  font-size: 40px;
  font-family: PingFang SC;
  font-weight: bold;
  line-height: 56px;
  color: #000000;
  opacity: 1;
}
.recovery-call {
  color: #757477;
}
</style>
